//    Copyright (C) Kherty.  All rights reserved.
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;

namespace OpenLS.Drawing.UI
{
    partial class TextResources
    {
        public TextResources()
        {
            InitializeComponent();
        }
        void OnLoaded(object sender, RoutedEventArgs args)
        {
            var tb = (RichTextBox)sender;
            TextBody textBody = (TextBody) tb.DataContext;
            tb.Document = textBody.Document;
        }
        static readonly TextResources _singleton = new TextResources();
        public static DataTemplate SmallTextBodyTemplate { get { return (DataTemplate) _singleton["smallTextBodyTemplate"]; } }

        private void UIElement_OnLostFocus(object sender, RoutedEventArgs e)
        {
            var tb = (RichTextBox)sender;
            TextBody textBody = (TextBody)tb.DataContext;
            textBody.Document = tb.Document;

        }
    }
}
